package com.glw.sso.platform.domain.mapper;

import com.glw.sso.platform.domain.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glw.sso.platform.domain.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 系统菜单表 Mapper 接口
 * </p>
 *
 * @author AutoGenerator
 * @since 2021-10-31
 */
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("select m.* " +
            "from system_role r " +
            "         inner join system_role_user ru on r.uuid = ru.role_uuid " +
            "         inner join system_role_menu rm on r.uuid = rm.role_uuid " +
            "         inner join system_menu m on rm.menu_uuid = m.uuid " +
            "where ru.user_pin = #{pin} and r.app_id = #{appId}")
    List<Menu> getUserMenu(@Param("pin") String pin, @Param("appId") String appId);
}
